package com.smalls.newvideotwo.mvp.model;

import com.smalls.newvideotwo.db.Album;
import com.smalls.newvideotwo.db.VodDao;
import com.smalls.newvideotwo.module.welcome.WelcomeActivity;
import com.smalls.newvideotwo.mvp.base.BaseBeanResult;
import com.smalls.newvideotwo.mvp.beanResult.FilterContentResult;
import com.smalls.newvideotwo.mvp.model.modelInterface.IFilterContentModel;
import com.smalls.newvideotwo.utils.Constant;

import java.util.List;

public class FilterContentModel implements IFilterContentModel {
    private static String TAG = Constant.baddcoolio2tag? Constant.TAGPREFIXSTR + "FilterContentModel":"FilterContentModel";
    @Override
    public void filterContent(String country, String tag, String age, BaseBeanResult baseBeanResult) {
        VodDao vodDao = new VodDao();
        List<Album> albumList = vodDao.queryAlbumByFilter(country,tag,age);
        FilterContentResult searchByNameResult = new FilterContentResult();
        searchByNameResult.setmAlbumList(albumList);
        searchByNameResult.setCountry(country);
        searchByNameResult.setAge(age);
        searchByNameResult.setTag(tag);
        if(albumList!=null) {
            baseBeanResult.onNext(searchByNameResult);
        } else {
            baseBeanResult.onError(new Throwable());
        }
    }
}
